<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.google.appengine.api.users.User" %>
<%@ page import="com.google.appengine.api.users.UserService" %>
<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>

<%@ page import="com.google.appengine.api.blobstore.BlobstoreServiceFactory" %>
<%@ page import="com.google.appengine.api.blobstore.BlobstoreService" %>

<html>
  <body>

<%
    BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
%>

<%
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    if (user != null) {
%>
<p>Hola, <%= user.getNickname() %>! (Puedes 
<a href="<%= userService.createLogoutURL(request.getRequestURI()) %>">finalizar la sesión</a>.)</p>
<%
    } else {
%>
<p>Hola!
<a href="<%= userService.createLoginURL(request.getRequestURI()) %>">Iniciar sesión</a>
to include your name with greetings you post.</p>
<%
    }
%>

  <form action="/secure/ConversionText2OtherFormat" method="post">
	  <label>Texto a convertir en imágen:</label><br/>
	  <textarea rows="20" cols="100" name="textoAConvertir"></textarea><br/>
	  <label>Convertir a:</label>
	  <select name="formatoDestino">
		  <option value="application/pdf">Documento Pdf</option>
		  <option value="image/png">Imágen</option>
	  </select>
	  <input type="submit" value="Enviar">
  </form>
  
  <br/>
  
  <form action="<%= blobstoreService.createUploadUrl("/secure/ConversionImage2Text") %>" method="post" enctype="multipart/form-data">
	  <label>Imágen a convertir en texto (OCR):</label><br/>
	  <input type="file" name="imagenAConvertir"/>
	  <input type="submit" value="Enviar">
  </form>  

  </body>
</html>